var charts7 = "",
    option = "",
    LineData = "";

getLineData7(); // 获取数据

function getLineData7() {
    $.ajax({
        url: "http://188.131.167.236:9000/getPriceClass", //json文件位置
        type: "GET", //请求方式为get
        dataType: "json", //返回数据格式为json
        success: function(result) { //请求成功完成后要执行的方法
            if (!result) return;
            LineData = result;
            getLine7();
        }
    })
}

function getLine7() {
    option = {
        title: {
            text: ''
        },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}元 : {c}个 ({d}%)'
        },
        toolbox: {

        },
        grid: {
            top: '5%',
            left: '3%',
            right: '4%',
            bottom: '3%',
            width: '90%',
            containLabel: true
        },
        legend: {
            color:['#9474f9','#749f83','#91c7ae','#d48265','#61a0a8','#e4e290'],
            left: 'center',
            data: ['0-49', '50-99', '100-149','150-199', '200-300', "300以上"],
            textStyle:{
                color:'#ffffff',
            }
        },
        series: [

            {
                color:['#9474f9','#749f83','#91c7ae','#d48265','#61a0a8','#e4e290'],
                name: '',
                type: 'pie',
                radius: [30, 110],
                center: ['50%', '60%'],
                roseType: 'area',
                data: [
                    {value:LineData.class1 , name: '0-49'},
                    {value:LineData.class2 , name: '50-99'},
                    {value:LineData.class3 , name: '100-149'},
                    {value:LineData.class4 , name: '150-199'},
                    {value:LineData.class5 , name: '200-300'},
                    {value:LineData.class6 , name: "300以上"}
                ]

            }
        ]
    };
    //初始化echarts实例(这里的bar要根据自己的div的id进行修改.)
    charts7 = echarts.init(document.getElementById('charts7'));
    // 使用制定的配置项和数据显示图表
    charts7.setOption(option);
}
